package com.webproject.shop.common;

import org.apache.commons.lang3.StringUtils;
import org.springframework.util.DigestUtils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class ToolBox implements ErrorCode{
    private static final String salt = "为党为国为人民";
    //MD5加密模块
    public static String md5(String str) {
        if (StringUtils.isEmpty(str)) {
            throw new BusinessException(PARAMETER_ERROR, "参数不合法！");
        }
        return DigestUtils.md5DigestAsHex((str + salt).getBytes());
    }
}
